<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    {include="style"}
    {include="edit"}
  </head>
  
  <body>
   <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="/" target="main">{fun JZLANG('首页')}</a>
        <a href="{fun U('Member/index')}" >{fun JZLANG('会员管理')}</a>
        <a>
          <cite>{fun JZLANG('会员修')}改</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="{fun JZLANG('刷新')}">
        <i class="iconfont" style="line-height:30px">&#xe6aa;</i></a>
    </div>
    <div class="x-body layui-anim layui-anim-up">
        <form class="layui-form  layui-form-pane">
		<input name="go" value="1" type="hidden">
		<input name="id" value="{$data['id']}" type="hidden">
		
		<div class="layui-tab">
			  <ul class="layui-tab-title">
				<li class="layui-this">{fun JZLANG('基本')}</li>
				<li>{fun JZLANG('扩展')}</li>
				
			  </ul>
			  <div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
					  <span id="content_fields"></span>
					  <div class="layui-form-item">
						  <label for="L_pass" class="layui-form-label">
							  {fun JZLANG('密码')}
						  </label>
						  <div class="layui-input-inline">
							  <input type="password" id="L_pass" name="pass"  lay-verify="pass"
							  autocomplete="off" class="layui-input">
						  </div>
						  <div class="layui-form-mid layui-word-aux">
							  {fun JZLANG('6到16个字符,不修改请留空')}
						  </div>
					  </div>
					  <div class="layui-form-item">
						  <label for="L_repass" class="layui-form-label">
							  {fun JZLANG('确认密码')}
						  </label>
						  <div class="layui-input-inline">
							  <input type="password" id="L_repass" name="repass"  lay-verify="repass"
							  autocomplete="off" class="layui-input">
						  </div>
					  </div>

                   
	  
				</div>
				<div class="layui-tab-item">
                    <span id="ext_fields"></span>
				</div>
			  </div>
		</div>
		
          
          <div class="layui-form-item" style="text-align:center;">
              
              <button  class="layui-btn" lay-filter="add" lay-submit="">
                  {fun JZLANG('修改')}
              </button>
          </div>
      </form>
    </div>
    <script>
	{include="fields"}
		function deleteImage(elm){
			$(elm).prev().attr("src", "{__Tpl_style__}/style/images/nopic.jpg");
			$('#litpic').val("");
		}
        layui.use(['form','layer','upload','laydate'], function(){
            $ = layui.jquery;
          var form = layui.form,
          layer = layui.layer,
          laydate = layui.laydate,
		      upload = layui.upload;
		  laydate.render({
            elem: '#birthday' //指定元素
          });
        //图片上传接口
		  upload.render({
			elem: '#litpic_upload',
			url: "{fun U('Common/uploads')}" //上传接口
			,data:{molds:'member'}
			,done: function(res){ //上传成功后的回调
			 
				if(res.code==0){
					 $('#litpic_img').attr('src',res.url);
					 $('#litpic').val(res.url);
				}else{
					 layer.alert(res.error, {icon: 5});
				}
			 
			}
		  });
        

          //监听提交
          form.on('submit(add)', function(data){
            console.log(data);
			$.post("{fun U('Member/memberedit')}",data.field,function(res){
				var r = JSON.parse(res);
				
				if(r.code==0){
					 //发异步，把数据提交给php
					layer.msg("{fun JZLANG('修改成功')}", {icon: 6,time:2000},function () {
						
						{if($webconf['admintpl']=='tpl')}
						 window.location.href="{fun U('Member/index')}";
						{else}
						parent.layer.closeAll();
						{/if}
						
					});
				}else{
					layer.msg(r.msg);
				}
			
				
				
			})
           
            return false;
          });
          
              get_fields(0,{$data['id']});
              get_fields_ext(0,{$data['id']});
        });
    </script>
   
  </body>

</html>